package com.eastmountain.chinese.scanner;

import java.io.FileReader;
import java.io.BufferedReader;
import java.io.IOException;
import java.util.Scanner;
import java.util.Locale;
import java.util.regex.Pattern;

public class ChineseStringScanner {
    
    private static String japaneseString = "\u65e5\u672c\u8a9e\u6587\u5b57\u5217";
    
    private static Pattern chineseCharacter
        = Pattern.compile( "[" + "\u4E00" +  "-" + "\u9FBF" + "]" );

    public ChineseStringScanner() {

    }

    public static void main( String[] args ) throws IOException {
        
        Scanner s = null;
        String character = "";
        String characters = "";
        
        try {
            
            System.out.println( "\nChineseStringScanner starting\n" );
            
            s = new Scanner( japaneseString );
            s.useLocale(Locale.US);

            while ( s.hasNext() ) {
                
                //if ( s.hasNext( chineseCharacter ) ) {
                    
                    character = s.findInLine( chineseCharacter );
                    System.out.println( character );
                    
                //} else {
                    
                    //s.next();
                    
                //}
            }
            
        } finally {
            s.close();
        }

    }
    
}
